﻿namespace Devonline.Entity;

/// <summary>
/// 价格历史/供应商报价历史
/// </summary>
[Table("price_history"), DisplayName("价格历史")]
public class PriceHistory : EntitySetWithCreate, IEntitySet, IEntitySetWithCreate
{
    /// <summary>
    /// 供应商
    /// </summary>
    public virtual Supplier? Supplier { get; set; }
    /// <summary>
    /// 货品
    /// </summary>
    public virtual Product? Product { get; set; }
}

/// <summary>
/// 价格历史/供应商报价历史
/// </summary>
[Table("price_history"), DisplayName("价格历史")]
public abstract class PriceHistory<TKey> : EntitySetWithCreate<TKey>, IEntitySet<TKey>, IEntitySetWithCreate<TKey> where TKey : IConvertible
{
    /// <summary>
    /// 供应商
    /// </summary>
    [Column("supplier_id"), MaxLength(36), DisplayName("供应商"), Required, Excel]
    public virtual TKey SupplierId { get; set; } = default!;
    /// <summary>
    /// 货品编号
    /// </summary>
    [Column("product_id"), MaxLength(36), DisplayName("货品编号"), Required, Excel]
    public virtual TKey ProductId { get; set; } = default!;
    /// <summary>
    /// 报价
    /// </summary>
    [Column("price", TypeName = "decimal(18,2)"), DisplayName("报价"), Excel]
    public virtual decimal Price { get; set; }
}